<?php

namespace App\Http\Requests\Logic\Conference;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Illuminate\Support\Facades\Auth;

class QueryCollection extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
	 * 定义表单规则
	 *
	 * Date: 12/04/2018
	 * @author George
	 * @return array
	 */
    public function rules()
    {
        return [
        	'start_time' => 'nullable|date',
            'end_time' => 'nullable|date',
            'project_name' => 'nullable|string',
            'status' => [
                'nullable',
                Rule::in(array_keys(config('system.conference.status')))
            ],
			'type' => [
			    'nullable',
                Rule::in(array_keys(config('system.conference.type')))
            ],
        ];
    }

    /**
     * 定义表单验证错误消息
     *
     * Date: 11/04/2018
     * @author George
     * @return array
     */
    public function messages()
    {
        return [
            'start_time.date' => '请输入正确的时间',
            'end_time.data' => '请输入正确的时间',
            'project_name.string' => '请输入正确的项目',
            'type.in' => '会议类型不存在',
            'status.in' => '会议状态不存在',
        ];
    }
}
